/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.ofbiz.eclipse.model.webapp.SiteConf.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.ofbiz.eclipse.model.webapp.SiteConf.EditType;
import org.ofbiz.eclipse.model.webapp.SiteConf.EventType;
import org.ofbiz.eclipse.model.webapp.SiteConf.RequestMapType;
import org.ofbiz.eclipse.model.webapp.SiteConf.ResponseType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SecurityType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SiteConfPackage;
import org.ofbiz.eclipse.model.webapp.SiteConf.TrackServerhitType;
import org.ofbiz.eclipse.model.webapp.SiteConf.TrackVisitType;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Request Map Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getSecurity <em>Security</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getEvent <em>Event</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getResponse <em>Response</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getEdit <em>Edit</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getTrackServerhit <em>Track Serverhit</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getTrackVisit <em>Track Visit</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.RequestMapTypeImpl#getUri <em>Uri</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RequestMapTypeImpl extends EObjectImpl implements RequestMapType {
	/**
	 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected static final String DESCRIPTION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected String description = DESCRIPTION_EDEFAULT;

	/**
	 * The cached value of the '{@link #getSecurity() <em>Security</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSecurity()
	 * @generated
	 * @ordered
	 */
	protected SecurityType security;

	/**
	 * The cached value of the '{@link #getEvent() <em>Event</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEvent()
	 * @generated
	 * @ordered
	 */
	protected EventType event;

	/**
	 * The cached value of the '{@link #getResponse() <em>Response</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResponse()
	 * @generated
	 * @ordered
	 */
	protected EList<ResponseType> response;

	/**
	 * The default value of the '{@link #getEdit() <em>Edit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEdit()
	 * @generated
	 * @ordered
	 */
	protected static final EditType EDIT_EDEFAULT = EditType.TRUE;

	/**
	 * The cached value of the '{@link #getEdit() <em>Edit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEdit()
	 * @generated
	 * @ordered
	 */
	protected EditType edit = EDIT_EDEFAULT;

	/**
	 * This is true if the Edit attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean editESet;

	/**
	 * The default value of the '{@link #getTrackServerhit() <em>Track Serverhit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTrackServerhit()
	 * @generated
	 * @ordered
	 */
	protected static final TrackServerhitType TRACK_SERVERHIT_EDEFAULT = TrackServerhitType.TRUE;

	/**
	 * The cached value of the '{@link #getTrackServerhit() <em>Track Serverhit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTrackServerhit()
	 * @generated
	 * @ordered
	 */
	protected TrackServerhitType trackServerhit = TRACK_SERVERHIT_EDEFAULT;

	/**
	 * This is true if the Track Serverhit attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean trackServerhitESet;

	/**
	 * The default value of the '{@link #getTrackVisit() <em>Track Visit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTrackVisit()
	 * @generated
	 * @ordered
	 */
	protected static final TrackVisitType TRACK_VISIT_EDEFAULT = TrackVisitType.TRUE;

	/**
	 * The cached value of the '{@link #getTrackVisit() <em>Track Visit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTrackVisit()
	 * @generated
	 * @ordered
	 */
	protected TrackVisitType trackVisit = TRACK_VISIT_EDEFAULT;

	/**
	 * This is true if the Track Visit attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean trackVisitESet;

	/**
	 * The default value of the '{@link #getUri() <em>Uri</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUri()
	 * @generated
	 * @ordered
	 */
	protected static final String URI_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUri()
	 * @generated
	 * @ordered
	 */
	protected String uri = URI_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RequestMapTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SiteConfPackage.Literals.REQUEST_MAP_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDescription(String newDescription) {
		String oldDescription = description;
		description = newDescription;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__DESCRIPTION, oldDescription, description));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SecurityType getSecurity() {
		return security;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSecurity(SecurityType newSecurity, NotificationChain msgs) {
		SecurityType oldSecurity = security;
		security = newSecurity;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__SECURITY, oldSecurity, newSecurity);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSecurity(SecurityType newSecurity) {
		if (newSecurity != security) {
			NotificationChain msgs = null;
			if (security != null)
				msgs = ((InternalEObject)security).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SiteConfPackage.REQUEST_MAP_TYPE__SECURITY, null, msgs);
			if (newSecurity != null)
				msgs = ((InternalEObject)newSecurity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SiteConfPackage.REQUEST_MAP_TYPE__SECURITY, null, msgs);
			msgs = basicSetSecurity(newSecurity, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__SECURITY, newSecurity, newSecurity));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventType getEvent() {
		return event;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetEvent(EventType newEvent, NotificationChain msgs) {
		EventType oldEvent = event;
		event = newEvent;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__EVENT, oldEvent, newEvent);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEvent(EventType newEvent) {
		if (newEvent != event) {
			NotificationChain msgs = null;
			if (event != null)
				msgs = ((InternalEObject)event).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SiteConfPackage.REQUEST_MAP_TYPE__EVENT, null, msgs);
			if (newEvent != null)
				msgs = ((InternalEObject)newEvent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SiteConfPackage.REQUEST_MAP_TYPE__EVENT, null, msgs);
			msgs = basicSetEvent(newEvent, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__EVENT, newEvent, newEvent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ResponseType> getResponse() {
		if (response == null) {
			response = new EObjectContainmentEList<ResponseType>(ResponseType.class, this, SiteConfPackage.REQUEST_MAP_TYPE__RESPONSE);
		}
		return response;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EditType getEdit() {
		return edit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEdit(EditType newEdit) {
		EditType oldEdit = edit;
		edit = newEdit == null ? EDIT_EDEFAULT : newEdit;
		boolean oldEditESet = editESet;
		editESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__EDIT, oldEdit, edit, !oldEditESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetEdit() {
		EditType oldEdit = edit;
		boolean oldEditESet = editESet;
		edit = EDIT_EDEFAULT;
		editESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.REQUEST_MAP_TYPE__EDIT, oldEdit, EDIT_EDEFAULT, oldEditESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetEdit() {
		return editESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TrackServerhitType getTrackServerhit() {
		return trackServerhit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTrackServerhit(TrackServerhitType newTrackServerhit) {
		TrackServerhitType oldTrackServerhit = trackServerhit;
		trackServerhit = newTrackServerhit == null ? TRACK_SERVERHIT_EDEFAULT : newTrackServerhit;
		boolean oldTrackServerhitESet = trackServerhitESet;
		trackServerhitESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__TRACK_SERVERHIT, oldTrackServerhit, trackServerhit, !oldTrackServerhitESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetTrackServerhit() {
		TrackServerhitType oldTrackServerhit = trackServerhit;
		boolean oldTrackServerhitESet = trackServerhitESet;
		trackServerhit = TRACK_SERVERHIT_EDEFAULT;
		trackServerhitESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.REQUEST_MAP_TYPE__TRACK_SERVERHIT, oldTrackServerhit, TRACK_SERVERHIT_EDEFAULT, oldTrackServerhitESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetTrackServerhit() {
		return trackServerhitESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TrackVisitType getTrackVisit() {
		return trackVisit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTrackVisit(TrackVisitType newTrackVisit) {
		TrackVisitType oldTrackVisit = trackVisit;
		trackVisit = newTrackVisit == null ? TRACK_VISIT_EDEFAULT : newTrackVisit;
		boolean oldTrackVisitESet = trackVisitESet;
		trackVisitESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__TRACK_VISIT, oldTrackVisit, trackVisit, !oldTrackVisitESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetTrackVisit() {
		TrackVisitType oldTrackVisit = trackVisit;
		boolean oldTrackVisitESet = trackVisitESet;
		trackVisit = TRACK_VISIT_EDEFAULT;
		trackVisitESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.REQUEST_MAP_TYPE__TRACK_VISIT, oldTrackVisit, TRACK_VISIT_EDEFAULT, oldTrackVisitESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetTrackVisit() {
		return trackVisitESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getUri() {
		return uri;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUri(String newUri) {
		String oldUri = uri;
		uri = newUri;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.REQUEST_MAP_TYPE__URI, oldUri, uri));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case SiteConfPackage.REQUEST_MAP_TYPE__SECURITY:
				return basicSetSecurity(null, msgs);
			case SiteConfPackage.REQUEST_MAP_TYPE__EVENT:
				return basicSetEvent(null, msgs);
			case SiteConfPackage.REQUEST_MAP_TYPE__RESPONSE:
				return ((InternalEList<?>)getResponse()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SiteConfPackage.REQUEST_MAP_TYPE__DESCRIPTION:
				return getDescription();
			case SiteConfPackage.REQUEST_MAP_TYPE__SECURITY:
				return getSecurity();
			case SiteConfPackage.REQUEST_MAP_TYPE__EVENT:
				return getEvent();
			case SiteConfPackage.REQUEST_MAP_TYPE__RESPONSE:
				return getResponse();
			case SiteConfPackage.REQUEST_MAP_TYPE__EDIT:
				return getEdit();
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_SERVERHIT:
				return getTrackServerhit();
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_VISIT:
				return getTrackVisit();
			case SiteConfPackage.REQUEST_MAP_TYPE__URI:
				return getUri();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SiteConfPackage.REQUEST_MAP_TYPE__DESCRIPTION:
				setDescription((String)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__SECURITY:
				setSecurity((SecurityType)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__EVENT:
				setEvent((EventType)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__RESPONSE:
				getResponse().clear();
				getResponse().addAll((Collection<? extends ResponseType>)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__EDIT:
				setEdit((EditType)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_SERVERHIT:
				setTrackServerhit((TrackServerhitType)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_VISIT:
				setTrackVisit((TrackVisitType)newValue);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__URI:
				setUri((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SiteConfPackage.REQUEST_MAP_TYPE__DESCRIPTION:
				setDescription(DESCRIPTION_EDEFAULT);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__SECURITY:
				setSecurity((SecurityType)null);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__EVENT:
				setEvent((EventType)null);
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__RESPONSE:
				getResponse().clear();
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__EDIT:
				unsetEdit();
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_SERVERHIT:
				unsetTrackServerhit();
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_VISIT:
				unsetTrackVisit();
				return;
			case SiteConfPackage.REQUEST_MAP_TYPE__URI:
				setUri(URI_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SiteConfPackage.REQUEST_MAP_TYPE__DESCRIPTION:
				return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
			case SiteConfPackage.REQUEST_MAP_TYPE__SECURITY:
				return security != null;
			case SiteConfPackage.REQUEST_MAP_TYPE__EVENT:
				return event != null;
			case SiteConfPackage.REQUEST_MAP_TYPE__RESPONSE:
				return response != null && !response.isEmpty();
			case SiteConfPackage.REQUEST_MAP_TYPE__EDIT:
				return isSetEdit();
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_SERVERHIT:
				return isSetTrackServerhit();
			case SiteConfPackage.REQUEST_MAP_TYPE__TRACK_VISIT:
				return isSetTrackVisit();
			case SiteConfPackage.REQUEST_MAP_TYPE__URI:
				return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (description: ");
		result.append(description);
		result.append(", edit: ");
		if (editESet) result.append(edit); else result.append("<unset>");
		result.append(", trackServerhit: ");
		if (trackServerhitESet) result.append(trackServerhit); else result.append("<unset>");
		result.append(", trackVisit: ");
		if (trackVisitESet) result.append(trackVisit); else result.append("<unset>");
		result.append(", uri: ");
		result.append(uri);
		result.append(')');
		return result.toString();
	}

} //RequestMapTypeImpl
